// 例子29

function Person(name, age) {
    this.name = name;
    this.age = age;
    this.getName = function() {
        console.log('this is constructor.');
    }
}

Person.prototype.getName = function() {
    return this.name;
}

var Tom = new Person('Tom', 20);
Tom.getName(); // this is constructor
console.log('name' in Tom)
